import { request } from "@/api/service";
import { BUTTON_STATUS_NUMBER } from "@/config/button";
import { urlPrefix as complaintsPrefix } from "./api";


export const crudOptions = vm => {
  return {
    pageOptions: {
      compact: true,
      export:{
        local:true,//本地导出，false为服务端导出
      },
    },
    options: {
      tableType: "vxe-table",
      rowKey: true, // 必须设置，true or false
      rowId: "id",
      height: "100%", // 表格高度100%, 使用toolbar必须设置
      highlightCurrentRow: false
    },
    rowHandle: {
      width: 140,
      view: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Retrieve");
        }
      },
      edit: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Update");
        }
      },
      remove: {
        thin: true,
        text: "",
        disabled() {
          return !vm.hasPermissions("Delete");
        }
      }
    },
    indexRow: {
      // 或者直接传true,不显示title，不居中
      title: "序号",
      align: "center",
      width: 100
    },
    viewOptions: {
      componentType: "form"
    },
    formOptions: {
      defaultSpan: 24, // 默认的表单 span
      width: "35%"
    },
    columns: [{
      title: "ID",
      key: "id",
      show: false,
      disabled: true,
      width: 90,
      form: {
        disabled: true
      }
    },
    {
      title: "企业名称",
      key: "企业名称",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "企业名称必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入企业名称"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "统一社会信用代码",
      key: "统一社会信用代码",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "统一社会信用代码必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入统一社会信用代码"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "辖区(属地监管所)",
      key: "辖区_属地监管所_field",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      search: {
        component: {
          props: {
            clearable: true
          }
        }
      },
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "辖区_属地监管所_field必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入辖区_属地监管所_field"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "获得iso9000证书情况",
      key: "获得iso9000证书情况",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      /*search: {
      component: {
          props: {
              clearable: true
          }
      }
      },*/
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "获得iso9000证书情况必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入获得iso9000证书情况"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "证书状态",
      key: "证书状态",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      /*search: {
      component: {
          props: {
              clearable: true
          }
      }
      },*/
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "证书状态必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入证书状态"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "认证机构",
      key: "认证机构",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      /*search: {
      component: {
          props: {
              clearable: true
          }
      }
      },*/
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "认证机构必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入认证机构"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "证书截止日期",
      key: "证书截止日期",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "date",
      /*search: {
      component: {
          props: {
              clearable: true
          }
      }
      },*/
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "证书截止日期必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入证书截止日期"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "住所",
      key: "住所",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      /*search: {
      component: {
          props: {
              clearable: true
          }
      }
      },*/
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "住所必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入住所"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    {
      title: "主要产品或品牌",
      key: "主要产品或品牌",
      width: 200,
      sortable: true,
      treeNode: true,

      type: "input",
      /*search: {
      component: {
          props: {
              clearable: true
          }
      }
      },*/
      form: {
        editDisabled: true,
        rules: [
          // 表单校验规则
          { required: true, message: "主要产品或品牌必填" }
        ],
        component: {
          props: {
            clearable: true
          },
          placeholder: "请输入主要产品或品牌"
        },
        itemProps: {
          class: { yxtInput: true }
        }
      }
    },
    ].concat(vm.commonEndColumns())
  };
};
